Previous | Chapter contents | Next | Book PDF
AppleScript groups chunks of scriptability API in "suites." Suites consist of a set of class descriptions, a set of command descriptions, and a set of terminologies for each supported AppleScript dialect. In the Mac OS, the suites an application supports are defined in the "aete" resource of the application. In the Yellow Box frameworks, suites are defined in property lists. Currently there are no special tools for creating property lists; you must create them by hand. Any bundle-including frameworks and applications-can declare script suites. The set of suites an application supports is a result of the union of all the suites defined by the application itself, the frameworks it links against, and the bundles it loads dynamically. The Yellow Box frameworks declare two suites and thus any scriptable application automatically supports these suites. These suites are the Core suite (NSCoreSuite) and the Text suite. Thus, if you expose access to an NSTextStorage object through your object hierarchy, that NSTextStorage object is fully and automatically scriptable through the standard Text suite. If your application uses the Application Kit's document architecture (discussed below), it automatically supports all the Core suite commands that can be applied to documents.
The property list that describes a suite contains all the information about the classes and commands in that suite that are needed by the scripting frameworks. For classes, this includes all the supported keys (attribute and relationship keys) for the class and their types. It also includes all the commands that the class supports (both from the class's own suite and others). For commands this includes the number and types of the arguments, whether they are required, and the return data type. The suite definition also includes information needed to map the classes and commands to the appropriate four-letter codes used to structure the data in an Apple event representing a script command. The scripting support uses Apple events as its transport mechanism to provide interscriptability between the Blue and Yellow Box environments. As a Yellow Box application developer, you should not have to deal with an Apple event directly to support scripting, but you will have to provide the information necessary to map classes, commands, keys, and related information to the codes used in Apple events.
In addition to the suite definition, which is a language-independent resource, a suite terminology contains dialect-specific terminology information that identifies the actual scripting vocabulary used for the various classes and commands.
The Yellow Box frameworks define several of the standard suites, particularly the Core and Text suites. In addition, Yellow Box classes implement scriptability for these standard suites so that, for instance, the NSTextStorage object is completely scriptable using the Text suite and the NSDocumentController and NSDocument objects support the Core scripting commands that make sense for documents.
Any application can define its own suites. In these suites they can define new script classes and new script commands.
Previous | Chapter contents | Next | Book PDF